﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace InternalManagementSystem.DAO
{
    public class DataAccessObject
    {
        public DataAccessObject()
        {
        }

        #region property

        private string _connectionString = null;

        public string ConnectionString
        {
            get
            {
                if (string.IsNullOrEmpty(_connectionString))
                {
                    GetConnectionString();
                }
                return _connectionString;
            }
        }

        private string _lastErrorMessage = null;

        public string LastErrorMessage
        {
            get { return _lastErrorMessage; }
            set { _lastErrorMessage = value; }
        }

        #endregion

        #region helper

        private void GetConnectionString()
        {

            _connectionString = ConfigurationManager.ConnectionStrings["testConn"].ConnectionString;
        }

        protected virtual void LogErrorMessage()
        {
            //to-do
        }

        protected virtual void Trace(string msg)
        {
            //to-do
        }

        #endregion
    }
}
